package com.ss.android.article.browser.constant;

import android.support.annotation.Nullable;
import android.util.Log;

import com.a.a.t;
import com.a.a.u;

import java.io.Closeable;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;

final class l extends t {
    private final k c;
    private final StringBuilder a;
    private final u b;

    l(k arg1, StringBuilder arg2, u arg3) {
        this.c = arg1;
        this.a = arg2;
        this.b = arg3;

    }

    public final void a(@Nullable Object arg6) {
        Closeable v1_2;
        FileWriter v1_1 = null;
        Iterator v1 = ((List) arg6).iterator();
        while (v1.hasNext()) {
            Object v0 = v1.next();
            this.a.append("<div class=box><a href=\'");
            this.a.append(((NaviItem) v0).mIconResId);
            this.a.append("\'></a><p class=\'black\'>");
            this.a.append(((NaviItem) v0).mLabelResId);
            this.a.append("</p><p class=\'font\'>");
            this.a.append(((NaviItem) v0).mIconResId);
            this.a.append("</p></div>");
        }

        this.a.append("</div></body></html>");
        File v3 = new File(this.c.a.b.getFilesDir(), "history.html");
        Closeable v2 = null;
        try {
            v1_1 = new FileWriter(v3, false);
            v1_1.write(this.a.toString());
        } catch (IOException v0_2) {
            Log.e("HistoryPage", "Unable to write history page to disk", ((Throwable) v0_2));
        } finally {
            b.onItem(((Closeable) v1_1));
            this.b.onItem("file://" + v3);
            this.b.onComplete();
        }
    }
}

